using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Nihonaid.Properties;
using Nihonaid.classes;

namespace Nihonaid
{
    public partial class SettingsForm : Form
    {
        public SettingsForm()
        {
            InitializeComponent();
        }

        private void cmbLearningScheduler_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

        private void btnApply_Click(object sender, EventArgs e)
        {
            Configuration.item_treshold = int.Parse(numericNewItems.Value.ToString());
            if (Configuration.todays_items > Configuration.item_treshold)
                Configuration.todays_items = Configuration.item_treshold;
            Configuration.scheduler = cmbLearningScheduler.SelectedIndex;
            Configuration.Save();

            Program.queue.SetSchedulerFromSettings();

            Program.settings_form.Hide();
            Program.learning_form.Show();
            Program.settings_form.Dispose();
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            Program.settings_form.Hide();
            Program.learning_form.Show();
        }

        private void SettingsForm_Load(object sender, EventArgs e)
        {
            numericNewItems.Value = Configuration.item_treshold;
            cmbLearningScheduler.SelectedIndex = Configuration.scheduler;
        }
    }
}